<?
//获取分类列表:
//$belong 所属板块
//$sortorder:排序项及排序方式
//$parent:传递过来的上级id，没有id就选root分类
//number:获取数据数量
function get_term_list($belong,$sortorder,$parent,$number)
{

  global $table_Prefix;
  global $sys_term_table;

//设置需要搜索的表格的前缀后缀
$table_Suffix = $sys_term_table;
$table = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀


  if($number){$limit_str=" limit ".$number;}
  else{$limit_str="";}

  $sort_str=" order by ".$sortby." ".$sortorder;

  if($parent)
  {
    $parent_str=" and term1 = '".$parent."' ";
    $parent_str=$parent_str." or term2 = '".$parent."' ";
    $parent_str=$parent_str." or term3 = '".$parent."' ";
    $parent_str=$parent_str." or term4 = '".$parent."' ";
    $parent_str=$parent_str." or term5 = '".$parent."' ";
  }
  else{$parent_str=" ";}

  $sqlstr="SELECT * FROM ".$table." where belong = '".$belong."'".$parent_str.$sort_str.$limit_str;

$result = mysql_query($sqlstr);

while ($row = mysql_fetch_array($result)) {

  $term['nid'][]           = $row['nid'];
  $term['mid'][]           = $row['mid'];
  $term['name'][]          = $row['name'];
  $term['title'][]         = $row['title'];
  $term['keyword'][]       = $row['keyword'];
  $term['description'][]   = $row['description'];
  $term['model'][]         = $row['model'];
  $term['introduce'][]     = $row['introduce'];
  //$term['detail'][]        = $row['detail'];
  $term['stock'][]         = $row['stock'];
  $term['price'][]         = $row['price'];
  $term['memberprice'][]   = $row['memberprice'];
  $term['discountprice'][] = $row['discountprice'];
  $term['local'][]         = $row['local'];
  $term['listorder'][]     = $row['listorder'];
  $term['publish'][]       = $row['publish'];
  $term['onsaletime'][]    = $row['onsaletime'];
  $term['inputtime'][]     = $row['inputtime'];
  $term['modifytime'][]    = $row['modifytime'];
  $term['banner'][]        = $row['banner'];
  $term['icon'][]          = $row['icon'];
  $term['image1'][]        = $row['image1'];
  $term['image2'][]        = $row['image2'];
  $term['image3'][]        = $row['image3'];
  $term['image4'][]        = $row['image4'];
  $term['image5'][]        = $row['image5']; 
  $term['vip_term'][]      = $row['vip_term']; 
  $term['url'][]           = $row['url'];
}

return $term;

}
?>

